<template>
	<div class="container">
		<div class="header">
			<div class="header-img"><img :src="avatar" /></div>
			<div class="header-body">
				<h1>{{ realname }}</h1>
				<router-link class="router-link-myhome" to="/myinformation" active-class="active-myhome">个人设置</router-link>
				<router-link class="router-link-myhome" to="/mycollection" active-class="active-myhome">我的收藏</router-link>
				<router-link class="router-link-myhome" to="/myactivities" active-class="active-myhome">我的活动</router-link>
			</div>
		</div>
		<div class="center">
			<div class="center-body"><router-view></router-view></div>
		</div>
	</div>
</template>

<script>
import { request } from '../api/axios.js';
export default {
	name: 'myhome',
	data() {
		return {
			avatar: '',
			realname: ''
		};
	},
	created() {
		this.mymessage();
	},
	methods: {
		mymessage() {
			setTimeout(() => {
				console.log(this.$store.state.userInfo);
				request({
					url: '/v1/users/getinfo',
					method: 'post',
					data: {
						userName: this.$store.state.userInfo.userName
					}
				}).then(res => {
					console.log(res.data.data);
					this.avatar = this.$store.state.publicStaticPath + this.$store.state.userInfo.avatar;
					this.realname = res.data.data.real_name;
					console.log(this.userName);
				});
			}, 600);

			// let authorization = localStorage.getItem('token');
			// request({
			// 	url: '/v1/users/魏美峰',
			// 	method: 'get',
			// 	headers: {
			// 		'Content-Type': 'multipart/form-data',
			// 		authorization
			// 	}
			// }).then(res => {
			// 	console.log(res.data.data);
			// 	this.myimag += res.data.data.头像;
			// 	this.realname = res.data.data.真实姓名;
			// 	console.log(this.myimag);
			// });
			// request({
			// 	url: '/v1/users/getinfo',
			// 	method: 'post',
			// 	data: {
			// 		userName:  this.$store.state.userInfo.userName
			// 	}
			// }).then(res => {
			// 	console.log(res.data.data);
			// });
		}
		// tomymessage() {
		// 	this.$router.push({
		// 		path: '/mymessage',
		// 		query: {
		// 			IndividualResume: this.IndividualResume,
		// 			myimag: this.myimag,
		// 			mynumber: this.mynumber,
		// 			school: this.school,
		// 			sex: this.sex,
		// 			PoliticsStatus: this.PoliticsStatus,
		// 			nickname: this.nickname,
		// 			phone: this.phone,
		// 			realname: this.realname,
		// 			idnumber: this.idnumber,
		// 			idtype: this.idtype,
		// 			mailbox: this.mailbox
		// 		}
		// 	});
		// },
	},
	onLoad() {}
};
</script>

<style scoped>
.container {
}
.header {

	display: flex;
	background-color: #ffffff;
	width: 100%;
	height: 11rem;
}
.header .header-img img {
	height: 10rem;
	width: 10rem;
	margin-top: 2rem;
	margin-left: 1rem;
}
.header .header-body {
	margin-top: 5rem;
	margin-left: 5rem;
}
.header .header-body h1 {
margin-bottom: 2rem;
}
.router-link-myhome {
	
	text-decoration: none;
	color: #262626;
	font-size: 1rem;
	margin: 0 3rem 0 0;
}
.center {
	height: 100%;
}
.center-top {
}
.active-myhome {

	bottom: -1px;
	border-bottom: 0.25rem solid red;
	border-radius: 0.3125rem;
	line-height: 1rem;
}
</style>
